create table if not exists jms_dm.dm_order_terminal_dispatch_code_operate_detail_dt(
     waybill_no                        varchar(255) comment '运单号'
    ,operate_date                      date         comment '操作日期'
    ,operate_time                      varchar(255) comment '操作时间'
    ,old_terminal_dispatch_code        varchar(255) comment '原三段码'
    ,new_terminal_dispatch_code        varchar(255) comment '新三段码'
    ,operate_type                      int          comment '操作类型 1-下单 2-转寄扫描 3-退件扫描 4-错分核查'
    ,network_code                      varchar(255) comment '操作网点code'
    ,network_name                      varchar(255) comment '操作网点名称'
    ,operator_code                     varchar(255) comment '操作人code'
    ,operator_name                     varchar(255) comment '操作人名称'
    )
ENGINE=OLAP
DUPLICATE KEY(`waybill_no`, `operate_date`, `operate_time`)
comment '三段码操作明细'
PARTITION BY RANGE(`operate_date`)
(
    START ("2023-04-01") END ("2023-11-15") EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(`waybill_no`) BUCKETS 1
PROPERTIES (
  "replication_num" = "3",
  "dynamic_partition.enable" = "true",
  "dynamic_partition.time_unit" = "DAY",
  "dynamic_partition.time_zone" = "Asia/Shanghai",
  "dynamic_partition.start" = "-200",
  "dynamic_partition.end" = "3",
  "dynamic_partition.prefix" = "p",
  "dynamic_partition.buckets" = "1",
  "in_memory" = "false",
  "storage_format" = "V2",
  "enable_persistent_index" = "false"
);
